#!/usr/bin/env bash

set -e

if [ ! "$#" -eq 2 ];then
  echo usage:
  echo "  " $0 file.metric file.sol
  exit
fi

cat > $2 <<EOF
MeshVersionFormatted 2

Dimension 3

SolAtVertices
`cat $1 | wc -l | tr -d '[:space:]'`
1 3

EOF

awk '{print $1, $2, $4, $3, $5, $6}' $1 >> $2

echo >> $2
echo End >> $2

